package thread.sisuo;

public class LeftRgithDeadlock {

    private final Object left = new Object();
    private final Object right = new Object();

    public void leftRight() {

        synchronized (left) {
            synchronized (right) {
                System.out.println("执行了leftRight方法");
            }
        }
    }
        public void rightLeft(){
            synchronized (right) {
                synchronized (left) {
                    System.out.println("执行了right方法");
                }
            }

    }
}


